package com.ad.pet.app.account.order.view;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;

import com.ad.pet.Logger;
import com.ad.pet.R;

/**
 * Created by SEELE on 2019/1/30.
 */

public class CancelSuccessDialog extends Dialog {
    private int screenWidth;
    public CancelSuccessDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
        screenWidth = context.getResources().getDisplayMetrics().widthPixels;
        initViews(context);
    }

    private void initViews(Context context) {

        View view = View.inflate(context, R.layout.layout_cancal_order_success,null);
        Button btnOk = view.findViewById(R.id.btn_ok);
        ImageView ivClose = view.findViewById(R.id.iv_close);
        btnOk.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
        ivClose.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
        setContentView(view);

        Window window = this.getWindow();
        WindowManager.LayoutParams lp = window.getAttributes();
        Logger.e("screew:"+screenWidth);
        lp.width = (screenWidth *  8/ 10); // 设置宽度
//        lp.height = (int)(lp.width*1.7);
        this.getWindow().setAttributes(lp);
        window.setGravity(Gravity.CENTER);




    }


}
